<?php
$params = array_merge(
    require __DIR__ . '/../../common/config/params.php',
    require __DIR__ . '/../../common/config/params-local.php',
    require __DIR__ . '/params.php',
    require __DIR__ . '/params-local.php'
);
return [
    'id' => 'app-frontend',
    'basePath' => dirname(__DIR__),
    'controllerNamespace' => 'frontend\controllers',
    'bootstrap' => ['log'],
    'modules' => [],
    'components' => [
        'request' => [
            'csrfParam' => '_csrf-frontend',
            'parsers' => [
                'application/json' => 'yii\web\JsonParser',
                'text/json' => 'yii\web\JsonParser',
            ],
        ],
        'response' => [
            'format' => 'json',
            'class' => 'yii\web\Response',
            'on beforeSend' => function ($event) {
                $response = $event->sender;
                $response->data = [
                    'success' => $response->isSuccessful,
                    'code' => $response->getStatusCode(),
                    'message' => $response->statusText,
                    'data' => $response->data,
                ];
                $response->statusCode = 200;
            },
        ],
        'user' => [
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-frontend', 'httpOnly' => true],
        ],

        'cache' => [
//            'class' => 'yii\caching\FileCache',
            'class'=>'yii\redis\Cache',//使用redis缓存作为项目缓存
            'redis'=>[
                'hostname' => '127.0.0.1',
                'port' =>'6379' ,
                'database' => 0
            ],
        ],

        'session' => [
            // this is the name of the session cookie used for login on the frontend
            'name' => 'frontend',
            'timeout'=>2592000,
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'enableStrictParsing' => true,
            'showScriptName' => false,
            'rules' => [
                [
                    'class' => 'yii\rest\UrlRule',
                    'pluralize'     => false,  // 关闭复数形式
                    'controller' => [
                        'project',
                        'banner',
                        'movie',
                    ],
                ],

                'GET get_recommend_project_list'=>'project/get-recommend-project-list', //获取推荐项目列表
                'POST get_project_info'=>'project/get-project-info', // 获取项目详情
                'GET get_index_project_info'=>'project/get-index-project-info', // 获取项目首页总分类列表
                'GET get_target_project_list'=>'project/get-target-project-list', // 获取某类项目列表
                'GET get_project_class_list'=>'project/get-project-class-list',  // 获取项目分类列表
                'POST get_project_actor_info'=>'project/get-project-actor-info', // 获取项目演职人员
                'POST get_project_banner_info'=>'project/get-project-banner-info', // 获取项目海报
                'POST get_project_video_info'=>'project/get-project-video-info', // 获取项目视频
                'POST get_project_information_info'=>'project/get-project-information-info', // 获取项目动态
                'POST get_project_posts_list'=>'project/get-project-posts-list', // 获取项目帖子列表
                'POST project_collect'=>'project/project-collect',  // 收藏项目
                'POST get_is_collect_project'=>'project/get-is-collect-project',  // 查询是否收藏了改项目
                'POST get_index_search_list'=>'project/get-index-search-list',  //获取首页搜索结果列表
                'POST get_allowed_join_group'=>'project/get-allowed-join-group',  //获取会员是否有权限加入群组

                'GET get_banner_list'=>'banner/get-banner-list',  //获取banner列表
                'GET get_information_list'=>'information/get-information-list',  // 获取资讯列表
                'GET get_index_information_list'=>'information/get-index-information-list',  // 获取首页资讯列表
                'GET get_information_class_list'=>'information/get-information-class-list',  // 获取资讯分类列表
                'POST get_information_info'=>'information/get-information-info',  // 获取资讯详情
                'GET get_hot_comment'=>'posts/get-hot-comment',  // 获取首页热门讨论
                'GET get_movie_box_office'=>'project/get-movie-box-office',  // 获取首页电影票房




                'POST get_member_info'=>'member/get-member-info',  // 获取会员基本信息
                'POST edit_member_info'=>'member/edit-member-info',  // 编辑会员信息
                'POST get_notice_list'=>'member/get-notice-list',  // 获取会员消息列表
                'POST get_member_comment_list'=>'member/get-member-comment-list',  // 获取会员评论列表
                'POST delete_member_comment'=>'member/delete-member-comment',  // 会员删除评论列表
                'POST get_member_collect_list'=>'member/get-member-collect-list',  // 获取会员收藏列表
                'POST member_avatar_upload'=>'member/avatar-upload',  // 会员头像鉴别上传
                'POST check_img'=>'member/check-img',  // 图片鉴别

                //cpy
                'login' => 'login/login',   //登录
                'register' => 'login/register',   //注册
                'get_pic_code' => 'login/get-pic-code',   //获取图形验证码
                'get_phone_code' => 'login/get-phone-code',   //获取手机验证码
                'get_mobile_code' => 'login/get-mobile-code',   //获取手机验证码
                'get_session_id' => 'login/get-session-id',   //获取session_id
                'check_token' => 'login/check-token',   //判断token是否有效
                'POST logout' => 'login/log-out',   //用户退出

                'movie_list' => 'movie/movie-list',   //影视学堂列表
                'movie_detail' => 'movie/movie-detail',   //详情
                'posts_list' => 'movie/posts-list',   //帖子列表
                'posts_detail' => 'movie/posts-detail',   //帖子详情
                'add_posts' => 'movie/add-posts',    //添加帖子
                'add_comment' => 'movie/add-comment',    //添加评论
                'click_like' => 'movie/click-like',    //点赞收藏
                'comment_list' => 'movie/comment-list',    //评论列表
                'catch_movie' => 'movie/catch-movie',    //获取院线票房
                'POST posts_img_upload'=>'movie/posts-img-upload',  // 发帖图片鉴别上传
                'catch_internet_movie' => 'movie/catch-internet-movie',    //获取网大票房
                'add_movie' => 'movie/add-movie',    //获取网大票房


                'group_cat_index' => 'group/group-cat-index',    //群组分类社群列表
                'hot_group' => 'group/hot-group',    //群组分类社群列表
                'hot_posts' => 'group/hot-posts',    //群组分类社群列表
                'group_list' => 'group/group-list',    //群组列表
                'group_detail' => 'group/group-detail',    //群组详情
                'add_group' => 'group/add-group',    //加入群组
                'my_group' => 'group/my-group',    //我的群组
                'quit_group' => 'group/quit-group',    //退出群组
                'group_add_posts' => 'group/add-posts',    //群组-添加帖子
                'group_add_comment' => 'group/add-comment',    //群组-评论

                'my_int' => 'weal/my-int',    //活动专区--我的积分
                'task_list' => 'weal/task-list',    //任务列表
                'weal_list' => 'weal/weal-list',    //福利列表
                'weal_detail' => 'weal/weal-detail',    //福利详情
                'weal_exchange' => 'weal/weal-exchange',    //福利兑换
                'my_weal' => 'weal/my-weal',    //我的福利
                'int_list' => 'weal/int-list',    //积分明细
                'sign_in' => 'weal/sign-in',    //签到
                'is_sign' => 'weal/is-sign',    //是否签到
                'sign_all' => 'weal/sign-all',    //签到数据
                'watch_video' => 'weal/watch-video',    //看视频
                'share_we_chart' => 'weal/share-we-chart',    //分享微信
                'watch_guide' => 'weal/watch-guide',    //观看操作指南

                'my_posts' => 'member/my-posts',    //我的发布
                'change_city' => 'member/change-city',    //选择城市
                'del_my_posts' => 'member/del-my-posts',    //删除我的发布

            ],
        ]
    ],
    'params' => $params,
];
